package com.example.xpvideo.service.serviceImpl;

import com.example.xpvideo.entity.Rolation;
import com.example.xpvideo.mapper.RolationMapper;
import com.example.xpvideo.service.RolationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 轮播图(Rolation)Service层
 *
 * @author 杨丽辉
 * @since 2021-08-09 18:17:27
 */
@Service
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
public class RolationServiceImpl implements RolationService {
        @Autowired
        private RolationMapper rolationMapper;


 /**
     * 通过ID和其他条件查询单条数据
     *
     * @param rolation 实例对象
     * @return 实例对象
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public Rolation queryRolationLimit1(Rolation rolation){
     return  rolationMapper.queryRolationLimit1( rolation);
     }
     
 /**
     * 查询指定行数据
     * @param rolation 实例对象
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   List<Rolation> queryAllRolationByLimit( Rolation rolation, Integer offset,  Integer limit){
   return rolationMapper.queryAllRolationByLimit(rolation, offset,limit);
  }

  /**
     * 查询数据条数
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int countAllRolation(Rolation rolation){
   return rolationMapper.countAllRolation( rolation);
   }
   /**
     * 通过实体作为筛选条件查询
     *
     * @param rolation 实例对象
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public List<Rolation> queryAllRolation(Rolation rolation){
   return rolationMapper.queryAllRolation(rolation);
   }
  /**
     * 新增数据
     *
     * @param rolation 实例对象
     * @return 影响行数
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public int insertRolation(Rolation rolation){
    return  rolationMapper.insertRolation( rolation);
    }
  /**
     * 修改数据
     *
     * @param rolation 实例对象
     * @return 影响行数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public  int updateRolation(Rolation rolation){
         return rolationMapper.updateRolation( rolation);
     }

    /**
     * 通过主键删除数据
     * @param id 主键
     * @return 影响行数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int deleteRolationById(Integer id){
   return  rolationMapper.deleteRolationById( id);
   }
     /**
     * 通过主键列表删除，列表长度不能为0
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int deleteRolationByIds( List<Integer> list){
    return  rolationMapper.deleteRolationByIds(  list);
  }
    
       /**
     * 通过主键修改实体列表，列表长度不能为0，注意：当实体属性为null时，对应的列也会别更新为null
     * @param list 集合
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int updateRolationBatch( List<Rolation> list){
   return  rolationMapper.updateRolationBatch(list);
   }
    /**
     * 批量其他列,除主键以外的列，列表长度不能为0,字段是空的就置为null
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
 public   int insertRolationBatch( List<Rolation> list){
 return rolationMapper.insertRolationBatch( list);
 }
      /**
     * 通过实体非空属性删除
     * @param rolation  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   int deleteRolationByEntity( Rolation rolation){
  return  rolationMapper.deleteRolationByEntity(  rolation);
  }
    /**
     * 通过实体不为空的属性作为筛选条件查询列表
     * @param rolation  实体
     * @return list
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  List<Rolation> listRolationByEntity(Rolation rolation){
   return rolationMapper.listRolationByEntity( rolation);
   }

 /**
     * 新增实体属性不为null的列
     * @param rolation  实体
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int insertRolationSelect( Rolation rolation){
      return rolationMapper.insertRolationSelect( rolation);

   }
   
      /**
     * 批量新增新增实体属性不为null的列
     * @param list  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int insertRolationListSelect( List<Rolation> list){

     return rolationMapper.insertRolationListSelect( list);
      }
     /**
     * 通过实体不为空的属性作为筛选条件查询单个
     * @param rolation  实体
     * @return 单个
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public  Rolation getRolationByEntity(Rolation rolation){
     return  rolationMapper.getRolationByEntity(rolation);
    }

}

